6/22/2021
The Calculator portion of the Pysistant has been completed. The issues, features, and more are listed below.
Problems and Solutions
I created a Scientific Calculator for Pysistant since I constantly find myself wanting to use parenthesis in my equations.
This came with many problems that I would have to face, including somehow trying to find the innermost set of parenthesis and
prioritizing those over other sets of parenthesis.
My solution to this problem was to have the program find the first right parenthesis. If you take this equation: ((2 + 2)* 3) + 4
You would solve the equation (2 + 2) first since the parenthesis are the innermost, these innermost equations are always paired with
the first occurrence of a ). So we can have the program scan for the first occurrence of a ) and evaluate the equation accordingly.
This is done in the logic function and is repeated until we have gone through the entire equation and have eliminated all parenthesis.
I would not be surprised if some very fringe equation would break the program, I tried to use every equation I could come up with but
I'm only one person.
Other problems I ran into were evaluating equations with the order of operations. This was a mores straightforward problem, similar to
the one mentioned above where we go through the loop first checking for exponents then multiplication until we finally reach subtraction.
This is done with the calc function.
All in all, creating the scientific calculator was a fun and challenging project. I tried to shy away from looking up external resources on
how other calculators work or how they deal with parenthesis. This was a really great project and since creating this I have a newfound respect
for calculators. You never know how amazing something is until you try to create it.
Follow the development of Pysistant here or on Github
This blog post is tagged: Pysistant.